package com.ruoyi.pack.domain;

import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 定位器对象 pack_locator
 *
 * @author ruoyi
 * @date 2024-01-01
 */
public class PackLocator extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 定位器ID */
    private Long locatorId;

    /** 定位器编码 */
    @Excel(name = "定位器编码")
    private String locatorCode;

    /** 绑定的运单ID（使用原container_id字段） */
    @Excel(name = "绑定的运单ID")
    private long containerId;

    /** 绑定的运单编号（冗余字段，方便查询） */
    private String containerCode;

    /** 保留字段（暂不使用） */
    private String materialCode;

    /** 设备型号 */
    @Excel(name = "设备型号")
    private String deviceModel;

    /** 生产日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date manufactureDate;

    /** 电池电量（百分比） */
    private Long batteryLevel;

    /** 信号强度 */
    private Long signalStrength;

    /** 定位器状态（1-正常 2-离线 3-故障 4-停用） */
    @Excel(name = "定位器状态", readConverterExp = "1=正常,2=离线,3=故障,4=停用")
    private String locatorStatus;

    /** 最后在线时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date lastOnlineTime;

    /** 绑定的运单信息 */
    private PackContainer boundContainer;  // 字段名保持不变，但语义改为存储运单信息

    public void setLocatorId(Long locatorId)
    {
        this.locatorId = locatorId;
    }

    public Long getLocatorId()
    {
        return locatorId;
    }
    public void setLocatorCode(String locatorCode)
    {
        this.locatorCode = locatorCode;
    }

    public String getLocatorCode()
    {
        return locatorCode;
    }

    private int bindStatus=0;

    public Long getContainerId()
    {
        return containerId;
    }

    public void setContainerId(Long containerId)
    {
        this.containerId = containerId;
    }

    /**
     * 获取运单编号
     */
    public String getContainerCode()
    {
        return containerCode;
    }

    /**
     * 设置运单编号
     */
    public void setContainerCode(String containerCode)
    {
        this.containerCode = containerCode;
    }

    public String getMaterialCode()
    {
        return materialCode;
    }

    public void setMaterialCode(String materialCode)
    {
        this.materialCode = materialCode;
    }

    public void setDeviceModel(String deviceModel)
    {
        this.deviceModel = deviceModel;
    }

    public String getDeviceModel()
    {
        return deviceModel;
    }
    public void setManufactureDate(Date manufactureDate)
    {
        this.manufactureDate = manufactureDate;
    }

    public Date getManufactureDate()
    {
        return manufactureDate;
    }
    public void setBatteryLevel(Long batteryLevel)
    {
        this.batteryLevel = batteryLevel;
    }

    public Long getBatteryLevel()
    {
        return batteryLevel;
    }
    public void setSignalStrength(Long signalStrength)
    {
        this.signalStrength = signalStrength;
    }

    public Long getSignalStrength()
    {
        return signalStrength;
    }
    public void setLocatorStatus(String locatorStatus)
    {
        this.locatorStatus = locatorStatus;
    }

    public String getLocatorStatus()
    {
        return locatorStatus;
    }
    public void setLastOnlineTime(Date lastOnlineTime)
    {
        this.lastOnlineTime = lastOnlineTime;
    }

    public Date getLastOnlineTime()
    {
        return lastOnlineTime;
    }

    public PackContainer getBoundContainer()
    {
        return boundContainer;
    }

    public void setBoundContainer(PackContainer boundContainer)
    {
        this.boundContainer = boundContainer;
    }

    /**
     * 获取绑定状态
     * @return bound-已绑定, unbound-未绑定
     */
    public int getBindStatus()
    {
        return bindStatus;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("locatorId", getLocatorId())
            .append("locatorCode", getLocatorCode())
            .append("containerId", getContainerId())
            .append("deviceModel", getDeviceModel())
            .append("manufactureDate", getManufactureDate())
            .append("batteryLevel", getBatteryLevel())
            .append("signalStrength", getSignalStrength())
            .append("locatorStatus", getLocatorStatus())
            .append("lastOnlineTime", getLastOnlineTime())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .toString();
    }

    public void setBindStatus(int bindStatus) {
        this.bindStatus = bindStatus;
    }
}
